import axios from "axios"

export const post = (url, data = {}) => {
  return new Promise((resolve, reject) => {
    axios.post(url, data, {
      baseURL: 'https://www.fastmock.site/mock/6336880122f3071e793b936974a3ffad',
      headers: {
        'Content-Type': 'application/json'
      }
    }).then((response) => {
      resolve(response.data)
    }, err => {
      reject(err)
      console.log('错误')
    })
  })
}


// 在组件里引入post方法，然后axios就可以简化成post('接口地址',{参数})